## Test script for testing remote RPC CALLS WHICH NEED
## admin authentication
##
## Usage: python testAdminXMLRPC.py [local]
import os,sys
import xmlrpclib

#VMWARE TEST NODE
user="000c29764c2e"
pw="00505630601a"

if len(sys.argv)==2:
    print 'Assuming local mode'
    server_url = 'http://%s:%s@localhost:8000/provisioner/xmlrpc/call/xmlrpc' % (user,pw)
else:
    server_url = 'http://%s:%s@update.braintrainerplus.com/xmlrpc/call/xmlrpc' % (user,pw)

server = xmlrpclib.Server(server_url)
print "TIME"
print server.giveMeTime()
updateInfo=server.getCurrentPackageInfo()

for update in updateInfo['packages']:
    print "Going to install:"
    print update
    print server.saveInstallLog(update['id'],'Simulated install went ok', 'ok')